import request, { type ListResponse, type ListQuery } from "@/utils/request";
import { type CouponType } from "./coupon";
import { type UserProfileType } from "../user/profile";

const BASE_URL = "/api/internal/CouponClaim";

export const CouponReceiveReceiveAPI = {
  getCouponReceiveList: (params: ListQuery) => {
    return request.get<any, ListResponse<CouponReceiveType>>(`${BASE_URL}/`, {
      params,
    });
  },
  getCouponReceiveDetail: (id: number) => {
    return request.get<any, CouponReceiveType>(`${BASE_URL}/${id}/`);
  },
};

export type CouponReceiveListQuery = {} & ListQuery;

export type CouponReceiveStatus = "no_used" | "used" | "expired";

export type CouponReceiveType = {
  id: number;
  user: UserProfileType;
  coupon: CouponType;
  created_at: string;
  updated_at: string;
  is_active: boolean;
  status: CouponReceiveStatus;
  used_at: null;
};

export default CouponReceiveReceiveAPI;
